home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
util
/
simulare.sit
/
Simula 4.07 Reference
/
card_53488.txt
< prev
next >
Wrap
Text File
|
1989-05-02
|
2KB
|
128 lines
-- card: 53488 from stack: in.07 Reference
-- bmap block id: 0
-- flags: 0000
-- background id: 13647
-- name:
-- part 1 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=12 top=79 right=312 bottom=199
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 3 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=198 top=79 right=263 bottom=322
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 4 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=321 top=79 right=263 bottom=495
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 5 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=301 top=271 right=293 bottom=385
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Comments
----- HyperTalk script -----
on mouseUp
go to card id 53606
end mouseUp
-- part contents for background part 2
----- text -----
Coroutine example, solution
-- part contents for card part 1
----- text -----
class Input;
begin
integer I, Count;
Detach;
Ch := Inchar;
while Ch<>'!' do
begin
if Digit(Ch) then
begin
Count := Rank(Ch)-Rank('0');
Ch := Inchar;
for I := 1 step 1 until Count do
Resume(Writer);
end
else
Resume(Writer);
end;
Resume(Writer);
end;
-- part contents for card part 3
----- text -----
class Output;
begin
Detach;
while Ch<>'!' do
begin
Outchar(Ch);
if Mod(Pos,4)=0 then
Outchar(' ');
if Pos>=121 then
Outimage;
Resume(Reader);
end;
if Pos>1 then
Outimage;
end;
-- part contents for card part 4
----- text -----
Main program:
begin
class Input; ...;
class Output; ...;
character Ch;
ref(Input) Reader;
ref(Output) Writer;
Reader :- new Input;
Writer :- new Output;
Resume(Reader);
end